using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;

namespace CodePlex.Resourceful
{
    public class NotifyObject : INotifyPropertyChanged
    {

        public event PropertyChangedEventHandler PropertyChanged;

        protected void OnPropertyChanged(string propertyName)
        {
            if (this.PropertyChanged != null)
            {
                this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        protected void Set<T>(T value, string name, ref T backingVariable)
        {
            if (object.Equals(backingVariable, value))
            {
                return;
            }

            backingVariable = value;
            this.OnPropertyChanged(name);

        }
    }

}
